package org.unikn.dbvis.gui;


import org.unikn.dbvis.tools.TestSketch;

import controlP5.Button;
import controlP5.ControlP5;
import controlP5.ControlWindow;
import controlP5.Slider;
import controlP5.Textfield;
import controlP5.Textlabel;

public class GuiControlsOverlay {
	private TestSketch p;
	public ControlP5 controlP5;
	public int myColorBackground = 100;
	private boolean showRelations=false;
	public Textfield filterField;
	public Slider timeSlider;
	/**
	 * @return the showRelations
	 */
	public boolean isShowRelations() {
		return showRelations;
	}
	public GuiControlsOverlay(TestSketch p){
		this.p = p;
		init();
	}
	public   void setP(final TestSketch p)
	{
		this.p = p;
		init();
	}
	public GuiControlsOverlay()
	{
		
	}
	public final void init()
	{
		controlP5 = new ControlP5( this.p);
		ControlWindow w = new ControlWindow(controlP5, this.p);

	  w.tabs().get(1).setLabel("Info");

	  /* will call method slider() below */
		Slider pointSizeSlider = controlP5.addSlider("Point Size",3,10,myColorBackground,20,20,100,14);
		pointSizeSlider.setId(1);
		
//		Slider tonalityBoundSlider = controlP5.addSlider("Tonality  Bound",-20,20,myColorBackground,20,40,100,14);
//		tonalityBoundSlider.setId(2);

		 timeSlider = controlP5.addSlider("Day ",0,15,myColorBackground,20,20,100,15);
		timeSlider.setValue(0);
		timeSlider.setId(5);

		Button resetFilter = controlP5.addButton("Reset Filter",0f, 222,95,100,14);
		resetFilter.setId(3);

	  Textlabel myTextfield = controlP5.addTextlabel("Info","To start filter your sources below. ",20,25);
	  Textlabel myTextfield2 = controlP5.addTextlabel("InfoLine2","Change visual settings and the timeline using the tabs above.",20,40);
	  

	  myTextfield.moveTo(w.tabs().get(1).getTab());
	  myTextfield2.moveTo(w.tabs().get(1).getTab());
	  pointSizeSlider.moveTo(w.tab("Appearance"));
//	  intervalButton.moveTo(w.tab("Appearance"));
	  pointSizeSlider.setValue(5);
//	  tonalityBoundSlider.moveTo(w.tab("Appearance"));
	  timeSlider.moveTo(w.tab("Timeline"));
	  
	  filterField = controlP5.addTextfield("filter",20,90,200,20);
	  filterField.setFocus(true);
		filterField.setId(1337);
		w.show();
	}
	public String filterValue() {
		// TODO Auto-generated method stub
		final String str =filterField.getText();
		filterField.setLabel("Filter " +str);
		return str;
	}

}